from django.contrib import admin
from import_export import resources
from house_comment_app.models import XmHouseUserComment
from house_comment_app.models import XmHouseMediaNews
from import_export.admin import ImportExportModelAdmin

# Register your models here.
'''
用户评论
'''
class UserCommentResource(resources.ModelResource):
    class Meta:
        model = XmHouseUserComment
        export_order = ('comment_id','comment_content','comment_date')

@admin.register(XmHouseUserComment)
class XmHouseUserCommentAdmin(ImportExportModelAdmin):
    # 导入数据
    export_order = ('comment_id','comment_content','comment_date')
    search_fields = ('comment_content','comment_date')
    resource_class = UserCommentResource

'''
媒体新闻
'''
class MediaNewsResource(resources.ModelResource):
    class Meta:
        model = XmHouseMediaNews
        export_order = ('news_id','news_content','news_date')

@admin.register(XmHouseMediaNews)
class XmMediaNewsAdmin(ImportExportModelAdmin):
    # 导入数据
    export_order = ('news_id','news_content','news_date')
    search_fields = ('news_content','news_date')
    resource_class = MediaNewsResource
